package it.ap.sa.acqua.tank.service.converter;

import org.springframework.stereotype.Component;

import it.ap.sa.acqua.dao.beans.TAssTankFishBean;
import it.ap.sa.acqua.dao.model.TAssTankFish;
import it.ap.sa.core.util.IBeanPopulate;

/**
 * Converter tra {@link TAssTankFish} e {@link TAssTankFishBean}
 * @author Alessandro Paolillo
 * @date 21 ott 2016
 * @version 1.0
 */
@Component
public class TAssTankFishConverter implements IBeanPopulate<TAssTankFish, TAssTankFishBean>{

	public TAssTankFishConverter() {
	}

	/**
	 * @author Alessandro Paolillo
	 * @date 21 ott 2016
	 * @version 1.0
	 * @see it.eng.tz.core.util.IBeanPopulate#convertdbToPage(java.lang.Object)
	 */
	@Override
	public TAssTankFishBean convertdbToPage(TAssTankFish src) throws Exception {
		TAssTankFishBean result = new TAssTankFishBean();
		if (src.getId()!=null) result.setId(src.getId());
		if (src.getIdFish()!=null) result.setIdFish(src.getIdFish());
		if (src.getIdTank()!=null) result.setIdTank(src.getIdTank());
		return result;
	}
	
	/**
	 * @author Alessandro Paolillo
	 * @date 21 ott 2016
	 * @version 1.0
	 * @see it.eng.tz.core.util.IBeanPopulate#convertpageToDb(java.lang.Object)
	 */
	@Override
	public TAssTankFish convertpageToDb(TAssTankFishBean src) throws Exception {
		TAssTankFish result = new TAssTankFish();
		if (src.getId()!=null) result.setId(src.getId());
		if (src.getIdFish()!=null) result.setIdFish(src.getIdFish());
		if (src.getIdTank()!=null) result.setIdTank(src.getIdTank());
		return result;
	}

}
